<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul {
            list-style: none;
            width: 200px;
           height: 800px;
           background-color:pink;
           padding: 0;

        }

        li {
            height: 30px;
            text-align: center;
            line-height: 30px;
           
            background-color: skyblue;
        }

        .active {
            height: 80px;
            line-height: 80px;
            background-color: yellow;
        }
    </style>
</head>

<body>
    <ul>
        <li class="active">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
    </ul>
</body>
<script>
    // let lis=document.querySelectorAll("li")
    // console.log(lis);
    // lis.forEach((el)=>{
    //     el.onmouseover=()=>{
    //         el.className=""
    //     }
    //     this.className="active"
    // }) 
    let lis = document.querySelectorAll("li")
    let ul=document.querySelector("ul")
    for (let i = 0; i < lis.length; i++) {
        lis[i].onmouseover = function () {

            for (var j = 0; j < lis.length; j++) {
                lis[j].className = '';

            }
            lis[i].className = 'active';
        }

    }
  
    //    for(let i=0;i<lis.length;i++){
        ul.onmouseout =()=> {
          console.log(333);
          // lis[0].classsName="active"
         
      }
    //    }
        
       

    
</script>

</html>